package com.cn.xiaonuo.slbfinances.slredbao.controller;

import com.cn.xiaonuo.common.entity.BusinessMessage;
import com.cn.xiaonuo.slbfinances.slredbao.service.IRedBaoService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class RedBaoController {
    @Resource
    private IRedBaoService redBaoService;

    @ApiOperation(value = "搜了宝--红宝兑换查询", notes = "搜了宝--红宝兑换查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", value = "用户id",example = "10086"),
            @ApiImplicitParam(name = "phone", value = "用户手机号",example = "13800138000"),
            @ApiImplicitParam(name = "beginDate", value = "开始日期(Long)",example = "1025455"),
            @ApiImplicitParam(name = "endDate", value = "结算日期(Long)",example = "5365220125"),
            @ApiImplicitParam(name = "pageNo", value = "页数", required = true),
            @ApiImplicitParam(name = "pageSize", value = "长度", required = true)
    })
    @RequestMapping(value = "/api/redbao/queryExchangeList", method = RequestMethod.POST)
    public BusinessMessage queryExchangeList(String userId, String phone, String beginDate, String endDate, Integer pageNo, Integer pageSize){
        return redBaoService.queryExchangeList(userId,phone,beginDate,endDate,pageNo,pageSize);
    }

    //股权兑换参数--客服修改
    @ApiOperation(value = "搜了宝--红宝全局配置", notes = "搜了宝--红宝全局配置")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", value = "用户id",example = "10086"),
            @ApiImplicitParam(name = "shareRate", value = "比率",example = "0.8"),
            @ApiImplicitParam(name = "monthMax", value = "最大月数",example = "10"),
            @ApiImplicitParam(name = "dayMax", value = "最大天数",example = "10"),
            @ApiImplicitParam(name = "shareRule", value = "规则",example = "2")
    })
    @RequestMapping(value = "/api/redbao/saveGqSystemConfig", method = RequestMethod.POST)
    public BusinessMessage saveGqSystemConfig(String userId,String shareRate,String monthMax,String dayMax,String shareRule){
        return redBaoService.saveGqSystemConfig(userId,shareRate,monthMax,dayMax,shareRule);
    }
}
